package cn.tx.redis7.test;

import java.util.HashSet;
import java.util.Set;

/**
 * @author jizenan
 * @date 2025/6/3
 * Description:
 */
public class HashDemo {
    public static void main(String[] args) {
        System.out.println("Aa".hashCode());
        System.out.println("BB".hashCode());
        System.out.println("柳柴".hashCode());
        System.out.println("柴柕".hashCode());

        Set<Integer> sets = new HashSet<>();
        int hashcode;
        for (int j = 0; j < 200000; j++) {
            hashcode = new Object().hashCode();
            if(sets.contains(hashcode)){
                System.out.println("运行到第:"+j+"次出现hash冲突，hashcode："+hashcode);
                continue;
            }
            sets.add(hashcode);
        }
    }
}
